

//轮播图

let slider1 = new Slider("slider1");
slider1.addArr();
slider1.addPoint();
// 回到顶部 顶部悬浮

var oLi = document.querySelector(".index_right_li");
// console.log(oLi)
var oRight = document.querySelector(".index_right")
var oLeft=document.querySelector(".index_left")
// console.log(oRight)

var xf1=document.querySelector(".header_xdxf")
var xf2=document.querySelector(".header_xdxf_wrap")
console.log(xf2)


window.onscroll = function () { //监听滚动条滚动的事件
    var st = document.documentElement.scrollTop || document.body.scrollTop;
    console.log(st);

    if(st >=60){
        xf2.style.position="fixed";
        xf2.style.top="0px";
        xf2.style.background="#fff";
        xf1.style.display="block"   
       xf2.style.width="100%"
       xf2.style.display="block"   
      
    }else{
        xf1.style.display="none"
    }

    if (st > 950) {
        oRight.style.position = "fixed";
        oRight.style.top = "70px"
        oRight.style.right = "130px"

        oLeft.style.position = "fixed";
        oLeft.style.top = "70px"
        oLeft.style.left = "90px"

    }else{
        oRight.style.position = "absolute";
        oRight.style.top = "312px"
        oRight.style.right = "-90px"

        oLeft.style.position = "absolute";
        oLeft.style.top = "310px"
        oLeft.style.left = "-110px"
       
    }
}
oLi.onclick = function () {
    console.log("a")
    document.documentElement.scrollTop = 0; //可读可写
    document.body.scrollTop = 0;
}


$(".index_left_three li").click(function () {
    // flag = false;
    // return false;
    let index = $(this).index();
    // let jl=$(".sports_outhouse").eq(index).offset().top-30
    $("body,html").stop().animate({
        "scrollTop":$(".sports_outhouse").eq(index).offset().top-50
    }, 500, );

    // $(this).addClass("hover").siblings().removeClass("hover");


})


//首页侧边栏楼梯划过效果js

$(".index_left_two a").hover(function(){
    $(this).css("color","red")
    },
    function(){
        $(this).css("color","#333333")  
    })


$(".index_left_three li span").hover(function(){
$(this).css("color","red")
},
function(){
    $(this).css("color","#999999")  
})

// banner_list li划过出现右侧菜单

$(".banner_list li").hover(function(){
    $(this).find(".banner_list_xlcd").show()
},

function(){
    $(this).find(".banner_list_xlcd").hide()
})


//登录后顶部展示用户名
function Showdl() {
    if (getCookie("username")) {           
            var reg = /^(\d{3})\d{4}(\d{4})$/;
            let tel= getCookie("username")
            let a=tel.replace(reg, "$1****$2");        
            $(".ydl").text(a)
         $(".ydl").click(function(e){
             var evt=e||event
             return false
         })
         $(".mfzc").text("退出")
         $(".mfzc").click(function(e){
            var evt=e||event
            return false
           
        })

        $(".mfzc").click(function(){
            console.log("a")
          removeCookie("username")
          location.reload()
           
        })
       
    }

}
Showdl()
    
